/**
 * Dear programmer:
 * When I wrote this code, only god and I knew how it worked.
 * Now, only god knows it!
 *
 * @author: swx  Date: 2019-09-11 Time: 12:23
 */

import {RequestAction, RequestMethod} from "../configuration/RequestConfiguration";
import {AppRequestPath} from "../configuration/AppConfig";
import {API_PROCEDURE2,API_PROCEDURE3} from "../constant/API";
import global from "../configuration/global";

export const requestRetrieveOrderSweep = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': 'WHSKOrderSweepByUserid',
            'jn': str,
            'jnJson2': {"output":{"json":"no"}}
        },
        action
    )
};


export const requestRetrieveLinenAndBar = (action) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            "hotelId": global.hotelId,
            "fu": "ExecRetrieveJson",
            "jn": {
                "where": {
                    "1": "1"
                },
                "fileds": {
                    "fileds": ["mcode","text","dcode","price","dtext","hskp_otype"]
                },
                "table": {
                    "table": "viewJqGrid_whsk_LinenCode"
                },
                "wherestring": ["@@WS", ""]
            },
            "jnJson2": "{}",
        },
        action
    )
};

/**
 * 布草保存
 */
export const requestSave_linen = (action,str,str3) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE3,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': 'WHSKOrderSave_New',
            'jn': str,
            'jnJson2': "{}",
            'jnJson3':str3,
        },
        action
    )
}

/**
 * 酒水保存
 */
export const requestSave_bar = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': 'OrderBarPosting',
            'jn': str,
            'jnJson2': "{}",
        },
        action
    )
}


/**
 * 客房清扫查看
 */
export const requestOrderEventGetinfo = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': 'WHSKOrderEventGetinfo',
            'jn': str,
            'jnJson2': "{}",
        },
        action
    )
}

/**
 * 客房报修查看
 */
export const requestOrderQmsRepairGetinfo = (action,str) => {
    return RequestAction(
        AppRequestPath() + API_PROCEDURE2,
        RequestMethod.Post,
        {
            'hotelId': global.hotelId,
            'fu': 'OrderQmsRepairGetinfo',
            'jn': str,
            'jnJson2': "{}",
        },
        action
    )
}



